/*****************************************************************
Wowengine - v0.1

File: wen_node.h
Creation date: 2012-10-15
*****************************************************************/

/****************************************************************/
#ifndef WEN_NODE_H
#define WEN_NODE_H
//----------------------------------------------------------------
#include "system/wen_system.h"
#include "wen_spatial.h"

#include <vector>
//----------------------------------------------------------------
namespace wen
{
//----------------------------------------------------------------

using namespace std;

class WEN_API Node : public Spatial
{
	DECLARE_SMART_POINTER(Node);

public:	
	Node();
	virtual ~Node();

	int AddChild(Spatial* child);

	Spatial* GetChildAt(unsigned int index);

	unsigned int GetChildCount() const;
	vector<Spatial*>& GetAllChildren();

	void RemoveChild(Spatial* child, bool withCleanUp = true);
	Spatial* RemoveChildAt(unsigned int index, bool withCleanUp = true);
	void RemoveAllChilds(bool withCleanUp = true);

	Spatial* GetChildByName(const std::string& name);

	virtual void Update(float fTimeBetweenFrames);
	virtual void Draw(Render& rkRender);

	//Bvh
	void UpdateBoundingVolume(Render& rkRender);

	BVH* GetBVH() { return m_pkComposeBV; }

private:
	vector<Spatial*> m_childrenVector;

	BVH* m_pkComposeBV;

	std::vector<D3DXVECTOR3*> m_TransformedBVHVertices;
};
//----------------------------------------------------------------
} // end namespace
//----------------------------------------------------------------
#endif // WEN_NODE_H
//----------------------------------------------------------------